<?php
/**
 * List Vacancies page view
 *
 * Страница вида: список вакансий
 *
 * @package zfhrtool
 * @subpackage View
 */
$this->headTitle($this->translate('[LS_PAGE_TITLE_VACANCIES]'));
?>
<div id="main">
	<?php if ($this -> error != ""): ?>
		<div class="error">
			<?php echo $this -> translate( $this -> error ); ?>
		</div>
	<?php endif; ?>
	<table class="tablesorter" border="1" cellpadding="0" cellspacing="0">
	<thead>
		<tr class="head">
			<th>№</th>
			<th>Вакансия</th>
			<th>К-во</th>
            <th>Тесты</th>
			<th class="action">Действия</th>
		</tr>
	</thead>
	<tbody>
<?php if (!empty($this -> vacancies)): ?>
    <?php foreach ($this -> vacancies as $vacancy): ?>
		<tr class="item_row">
            <td><?php echo $this->escape( $vacancy->id ); ?></td>
			<td><?php echo $this->escape( $vacancy->name ); ?></td>
			<td><?php echo $this->escape( $vacancy->num ); ?></td>
			<td><?php if(isset($this -> tests[$vacancy->id])) foreach ($this -> tests[$vacancy->id] as $test) echo $this->escape($test['t_name'] ).'<br />'; ?></td>
			<td class="action">
                <a href="<?php echo $this -> url ( array ( 'controller' => 'vacancy', 'action' => 'edit', 'vacancyId' => $vacancy -> id) ); ?>"><?php echo '<img src="../public/images/edit.png" title="Изменить" class="img_doing" />'; ?></a>
                <a href="<?php echo $this -> url ( array ( 'controller' => 'vacancy', 'action' => 'remove', 'vacancyId' => $vacancy -> id) ); ?>" onClick="return confirm('<?php echo $this->translate('[LS_LINK_REMOVE_CONFIRMATION]'); ?> \' <?php echo $this->escape( $vacancy -> name ); ?>\'');"><?php echo '<img src="../public/images/delete2.png" title="Удалить" class="img_doing" />'; ?></a>
			</td>
		</tr>
    <?php endforeach; ?>
<?php else: ?>
		<tr class="item_row">
			<td></td>
			<td colspan="5">пока нет вакансий. <a href="<?php echo $this->url(array('controller' => 'vacancy', 'action' => 'edit')); ?>">добавить?</a></td>
		</tr>
<?php endif;?>
	</tbody>
	</table>
	<!-- End of Таблица тестов-->
</div>
